/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USERCFGDEFAULT_H__
#define __USERCFGDEFAULT_H__

#include <stdio.h>
#include <string.h>
#include <math.h>
#include "hal_rc8088_loadCfg.h"
#include "userCfg_far.h"
#include "userCfg_near.h"
#define get_log2(x)     ( log(fabs(x)) / log(2.0) )

//#define RC8088_REG_ADDR     (0x30000000)
//#define RC8088_PROFILE_ADDR  (RC8088_REG_ADDR+sizeof(RC8088_RegCfg_st))  // CBUF:8KB
//#define RC8088_USERCFG_ADDR  (RC8088_PROFILE_ADDR+8192)

#define MAX_PROFILE_NUM 20
#define MAX_PROFILEMEM_NUM 20
#define MAX_BPM_NUM   2048
typedef struct{
	uint32_t rampMemAddr;
	uint32_t rampMemIncLP;
	uint32_t rampCountLP;
	uint32_t rampMemIncHP;
	uint32_t rampCountHP;
	uint32_t rampPA_En;
	uint32_t rampSYNC_En;
	uint32_t startFreqMemAddr;
	uint32_t startFreqMemIncLP;
	uint32_t startFreqStepIncLP;
	uint32_t startFreqCountLP;
	uint32_t startFreqMemIncHP;
	uint32_t startFreqStepIncHP;
	uint32_t startFreqCountHP;
	uint32_t adcRmaMemAddr;
	uint32_t txEnMemAddr;
	uint32_t txEnMemInc;
	uint32_t txEnCount;
	uint32_t bpmMemInc;
	uint32_t bpmCount;
	uint32_t txPhaseMemAddr[8];
	uint32_t txPhaseMemInc[8];
	uint32_t txPhaseStepInc[8];
	uint32_t txPhaseCount[8];
}STRUCT_CFGCONST;
typedef struct{
	float rampBandwidthA;
	float rampTimeA;
	float rampBandwidthB;
	float rampTimeB;
	float rampBandwidthC;
	float rampTimeC;
	float startFreq;
	float adcRma;
	float txEn;
	float txPhaseIdx[8];
}STRUCT_MEMCONST;

//读写配置文件的全局变量
typedef struct{
	uint16_t RC8088_TxpBuf[1024];
	uint16_t RC8088_BpmBuf[2048];
	uint32_t RC8088_ProfileCfgBuf[52*20];
	float    RC8088_ProfileMemBuf[17*20];
	//basicWave
	STRUCT_BASIC basicCfg;
	//advanceWave
	STRUCT_USERCFG_SF userSF;
	
	float advFreqStart;
	float advFreqStop;
	//common
	// int numFrame;
	int downFac;
	int numPT;
	int numPrepChirp;
	int cic_sec;
	int numRX;
	int rxAntSeq[8];
	int txAntPower;
	int rxAntGain0;
	int rxAntGain1;
	int rxAntGain2;
	int rxAntGain3;
	int HPF0;
	int HPF1;
	STRUCT_MIPICFG mipiCfg;
	int fftEn;
	int fftWinEn;
	int fftOutMode;
	int fftNumPT;
}STRUCT_USR_CONFIG_CONST;





// extern RC8088_RegCfg_st *rc8088_regCfg;
// extern STRUCT_RC8088_USERCFG *rc8088_userCfg;
// extern STRUCT_PROFILEMEM_ADDR *profMemAddr;
extern uint8_t g_profile_mem[8192];
extern STRUCT_USR_CONFIG_CONST g_rf_far_userconfig_default;
extern STRUCT_USR_CONFIG_CONST g_rf_near_userconfig_default;
extern STRUCT_USR_CONFIG_CONST g_rf_far_userconfig;
extern STRUCT_USR_CONFIG_CONST g_rf_near_userconfig;


void RC8088_userCfgDefault(RC8088_RWCfg_st *pCfg, STRUCT_RC8088_USERCFG *rc8088_userCfg,STRUCT_PROFILEMEM_ADDR *m_profMemAddr);
void RC8088_ProfileMemAddrInit(STRUCT_PROFILEMEM_ADDR *memAddr);

#endif /*__USERCFGDEFAULT_H__ */

/************************ (C) COPYRIGHT  *****END OF FILE****/























